package com.renshuai.demo.mybatis.config;

import java.beans.PropertyDescriptor;

import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class MyInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {

	
	public MyInstantiationAwareBeanPostProcessor() {
		super();
		System.out.println("MyInstantiationAwareBeanPostProcessor");
	}

	public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
		if (beanName.equals("order")) {
			
			System.out.println("postProcessBeforeInstantiation");
		}
		return null;
	}

	public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
		if (beanName.equals("order")) {
			
			System.out.println("postProcessAfterInstantiation");
		}
		return true;
	}

	public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName)
			throws BeansException {
		if (beanName.equals("order")) {
			
			System.out.println("postProcessProperties");
		}
		return null;
	}

	public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
			String beanName) throws BeansException {
		if (beanName.equals("order")) {
			
			System.out.println("postProcessPropertyValues");
		}
		return null;
	}

}
